home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 May: Tool Chest / Developer CD Series Tool Chest (Apple Computer)(May 1999).iso / Tool Chest / Development Kits / MPW etc / MPW-GM / MPW / Examples / PPCExamples / AExamples / MakeFunction.s
Encoding:
Text File  |  1998-12-03  |  905 b   |  29 lines  |  [TEXT/MPS ]

  1. ; MakeFunction sets up everything you need to make an assembly function 
  2. ; callable from C and debuggable with a symbolic debugger. It does the following:
  3. ; - export the function's transition vector
  4. ; - export the function name
  5. ; - create a toc entry for the function's transition vector
  6. ; - create the transition vector, which must contain
  7. ;     - the function entry point (the name of the function)
  8. ;     - the TOC anchor (the predefined variable TOC[tc0])
  9. ; - tell PPCAsm to create a function entry point symbol for symbolic debuggers
  10. ; - create a csect for the function (one csect per function lets the
  11. ;    linker do dead code stripping, resulting in smaller executables)
  12.     
  13.     MACRO
  14.     MakeFunction &fnName
  15.         EXPORT &fnName[DS]
  16.          EXPORT .&fnName[PR]
  17.         
  18.         TC &fnName[TC], &fnName[DS]
  19.             
  20.         CSECT &fnName[DS]
  21.             DC.L .&fnName[PR]
  22.              DC.L TOC[tc0]
  23.         
  24.         CSECT .&fnName[PR]
  25.         FUNCTION .&fnName[PR]    
  26.         
  27.     ENDM
  28.  
  29.